<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>The Package Construct</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
		<meta name="viewport" content="width=device-width initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="en-gb">

<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
<script>
function togglePopup(material_id) {
  var popup = document.getElementById(material_id);
  popup.classList.toggle("show");
}
</script>

<link href="../docs-assets/Popups.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
		
	</head>
	<body class="commentary-font">
		<nav role="navigation">
		<h1><a href="../index.html"><img src="../docs-assets/Inform.png" height=72> </a></h1>
<ul><li><a href="../index.html">home</a></li>
</ul><h2>Compiler</h2><ul>
<li><a href="../structure.html">structure</a></li>
<li><a href="../inbuildn.html">inbuild</a></li>
<li><a href="../inform7n.html">inform7</a></li>
<li><a href="../intern.html">inter</a></li>
<li><a href="../services.html">services</a></li>
<li><a href="../secrets.html">secrets</a></li>
</ul><h2>Other Tools</h2><ul>
<li><a href="../inblorbn.html">inblorb</a></li>
<li><a href="../inform6.html">inform6</a></li>
<li><a href="../inpolicyn.html">inpolicy</a></li>
</ul><h2>Resources</h2><ul>
<li><a href="../extensions.html">extensions</a></li>
<li><a href="../kits.html">kits</a></li>
</ul><h2>Repository</h2><ul>
<li><a href="https://github.com/ganelson/inform"><img src="../docs-assets/github.png" height=0> github</a></li>
</ul><h2>Related Projects</h2><ul>
<li><a href="https://github.com/ganelson/inweb"><img src="../docs-assets/github.png" height=0> inweb</a></li>
<li><a href="https://github.com/ganelson/intest"><img src="../docs-assets/github.png" height=0> intest</a></li>
</ul>
		</nav>
		<main role="main">
		<!-- Weave of 'The Package Construct' generated by inweb -->
<div class="breadcrumbs">
    <ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="../intern.html">Inter Modules</a></li><li><a href="index.html">bytecode</a></li><li><a href="index.html#4">Chapter 4: Void Constructs</a></li><li><b>The Package Construct</b></li></ul></div>
<p class="purpose">Defining the package construct.</p>

<ul class="toc"><li><a href="4-tpc.html#SP1">&#167;1. Definition</a></li><li><a href="4-tpc.html#SP2">&#167;2. Instructions</a></li><li><a href="4-tpc.html#SP6">&#167;6. Creating from textual Inter syntax</a></li><li><a href="4-tpc.html#SP7">&#167;7. Writing to textual Inter syntax</a></li><li><a href="4-tpc.html#SP9">&#167;9. Package vs its head vs its name symbol</a></li></ul><hr class="tocbar">

<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. Definition.</b>For what this does and why it is used, see <a href="../inter/M-ti.html" class="internal">Textual Inter (in inter)</a>.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">PackageInstruction::define_construct</span><button class="popup" onclick="togglePopup('usagePopup1')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup1">Usage of <span class="code-font"><span class="function-syntax">PackageInstruction::define_construct</span></span>:<br/>Inter Constructs - <a href="3-ic.html#SP15">&#167;15</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">void</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_construct</span><span class="plain-syntax"> *</span><span class="identifier-syntax">IC</span><span class="plain-syntax"> = </span><a href="3-ic.html#SP1" class="function-link"><span class="function-syntax">InterInstruction::create_construct</span></a><span class="plain-syntax">(</span><span class="constant-syntax">PACKAGE_IST</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"package"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="3-ic.html#SP2" class="function-link"><span class="function-syntax">InterInstruction::defines_symbol_in_fields</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IC</span><span class="plain-syntax">, </span><span class="constant-syntax">DEFN_PACKAGE_IFLD</span><span class="plain-syntax">, </span><span class="constant-syntax">TYPE_PACKAGE_IFLD</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="3-ic.html#SP8" class="function-link"><span class="function-syntax">InterInstruction::specify_syntax</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IC</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"package TOKENS _IDENTIFIER"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="3-ic.html#SP4" class="function-link"><span class="function-syntax">InterInstruction::data_extent_always</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IC</span><span class="plain-syntax">, </span><span class="constant-syntax">5</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="3-ic.html#SP3" class="function-link"><span class="function-syntax">InterInstruction::permit</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IC</span><span class="plain-syntax">, </span><span class="constant-syntax">OUTSIDE_OF_PACKAGES_ICUP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="3-ic.html#SP3" class="function-link"><span class="function-syntax">InterInstruction::permit</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IC</span><span class="plain-syntax">, </span><span class="constant-syntax">INSIDE_PLAIN_PACKAGE_ICUP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="3-ic.html#SP3" class="function-link"><span class="function-syntax">InterInstruction::permit</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IC</span><span class="plain-syntax">, </span><span class="constant-syntax">CAN_HAVE_CHILDREN_ICUP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">METHOD_ADD</span><span class="plain-syntax">(</span><span class="identifier-syntax">IC</span><span class="plain-syntax">, </span><span class="constant-syntax">CONSTRUCT_READ_MTID</span><span class="plain-syntax">, </span><a href="4-tpc.html#SP6" class="function-link"><span class="function-syntax">PackageInstruction::read</span></a><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">METHOD_ADD</span><span class="plain-syntax">(</span><span class="identifier-syntax">IC</span><span class="plain-syntax">, </span><span class="constant-syntax">CONSTRUCT_TRANSPOSE_MTID</span><span class="plain-syntax">, </span><a href="4-tpc.html#SP4" class="function-link"><span class="function-syntax">PackageInstruction::transpose</span></a><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">METHOD_ADD</span><span class="plain-syntax">(</span><span class="identifier-syntax">IC</span><span class="plain-syntax">, </span><span class="constant-syntax">CONSTRUCT_VERIFY_MTID</span><span class="plain-syntax">, </span><a href="4-tpc.html#SP5" class="function-link"><span class="function-syntax">PackageInstruction::verify</span></a><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">METHOD_ADD</span><span class="plain-syntax">(</span><span class="identifier-syntax">IC</span><span class="plain-syntax">, </span><span class="constant-syntax">CONSTRUCT_WRITE_MTID</span><span class="plain-syntax">, </span><a href="4-tpc.html#SP7" class="function-link"><span class="function-syntax">PackageInstruction::write</span></a><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">METHOD_ADD</span><span class="plain-syntax">(</span><span class="identifier-syntax">IC</span><span class="plain-syntax">, </span><span class="constant-syntax">CONSTRUCT_VERIFY_CHILDREN_MTID</span><span class="plain-syntax">, </span><a href="4-tpc.html#SP5" class="function-link"><span class="function-syntax">PackageInstruction::verify_children</span></a><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. Instructions.</b>In bytecode, the frame of a <span class="extract"><span class="extract-syntax">package</span></span> instruction is laid out with the
compulsory words &mdash; see <a href="2-in.html" class="internal">Inter Nodes</a> &mdash; followed by:
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">DEFN_PACKAGE_IFLD</span><span class="plain-syntax">    (</span><span class="constant-syntax">DATA_IFLD</span><span class="plain-syntax"> + </span><span class="constant-syntax">0</span><span class="plain-syntax">)</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">TYPE_PACKAGE_IFLD</span><span class="plain-syntax">    (</span><span class="constant-syntax">DATA_IFLD</span><span class="plain-syntax"> + </span><span class="constant-syntax">1</span><span class="plain-syntax">)</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">PTYPE_PACKAGE_IFLD</span><span class="plain-syntax">   (</span><span class="constant-syntax">DATA_IFLD</span><span class="plain-syntax"> + </span><span class="constant-syntax">2</span><span class="plain-syntax">)</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">SYMBOLS_PACKAGE_IFLD</span><span class="plain-syntax"> (</span><span class="constant-syntax">DATA_IFLD</span><span class="plain-syntax"> + </span><span class="constant-syntax">3</span><span class="plain-syntax">)</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">PID_PACKAGE_IFLD</span><span class="plain-syntax">     (</span><span class="constant-syntax">DATA_IFLD</span><span class="plain-syntax"> + </span><span class="constant-syntax">4</span><span class="plain-syntax">)</span>
</pre>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. </b>If you try to create uniquely-named subpackages all called <span class="extract"><span class="extract-syntax">bag</span></span> inside the
same package, you'll get <span class="extract"><span class="extract-syntax">bag</span></span>, then <span class="extract"><span class="extract-syntax">bag_1</span></span>, <span class="extract"><span class="extract-syntax">bag_2</span></span>, and so on.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> *</span><span class="function-syntax">PackageInstruction::new</span><button class="popup" onclick="togglePopup('usagePopup2')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup2">Usage of <span class="code-font"><span class="function-syntax">PackageInstruction::new</span></span>:<br/><a href="4-tpc.html#SP6">&#167;6</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_bookmark</span><span class="plain-syntax"> *</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">name</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_type</span><span class="plain-syntax"> </span><span class="identifier-syntax">type</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">uniquely</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">ptype_name</span><span class="plain-syntax">, </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">level</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_error_location</span><span class="plain-syntax"> *</span><span class="identifier-syntax">eloc</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_package</span><span class="plain-syntax"> **</span><span class="identifier-syntax">created</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> *</span><span class="identifier-syntax">E</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">uniquely</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">mutable</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">mutable</span><span class="plain-syntax">, </span><span class="string-syntax">"%S"</span><span class="plain-syntax">, </span><span class="identifier-syntax">name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">inter_package</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pack</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">N</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">, </span><span class="identifier-syntax">A</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">while</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">pack</span><span class="plain-syntax"> = </span><a href="2-pck.html#SP20" class="function-link"><span class="function-syntax">InterPackage::from_name</span></a><span class="plain-syntax">(</span><a href="2-bkm.html#SP6" class="function-link"><span class="function-syntax">InterBookmark::package</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">), </span><span class="identifier-syntax">mutable</span><span class="plain-syntax">)) != </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">TAIL</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">TAIL</span><span class="plain-syntax">, </span><span class="string-syntax">"_%d"</span><span class="plain-syntax">, </span><span class="identifier-syntax">N</span><span class="plain-syntax">++);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">A</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">Str::truncate</span><span class="plain-syntax">(</span><span class="identifier-syntax">mutable</span><span class="plain-syntax">, </span><span class="identifier-syntax">Str::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">mutable</span><span class="plain-syntax">) - </span><span class="identifier-syntax">A</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">A</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">TAIL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">mutable</span><span class="plain-syntax">, </span><span class="string-syntax">"%S"</span><span class="plain-syntax">, </span><span class="identifier-syntax">TAIL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Str::truncate</span><span class="plain-syntax">(</span><span class="identifier-syntax">mutable</span><span class="plain-syntax">, </span><span class="constant-syntax">31</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">TAIL</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><a href="4-tpc.html#SP4" class="function-link"><span class="function-syntax">PackageInstruction::new_inner</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">, </span><span class="identifier-syntax">mutable</span><span class="plain-syntax">, </span><span class="identifier-syntax">type</span><span class="plain-syntax">, </span><span class="identifier-syntax">ptype_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">level</span><span class="plain-syntax">, </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">, </span><span class="identifier-syntax">created</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">mutable</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><a href="4-tpc.html#SP4" class="function-link"><span class="function-syntax">PackageInstruction::new_inner</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">, </span><span class="identifier-syntax">name</span><span class="plain-syntax">, </span><span class="identifier-syntax">type</span><span class="plain-syntax">, </span><span class="identifier-syntax">ptype_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">level</span><span class="plain-syntax">, </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">, </span><span class="identifier-syntax">created</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">E</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. </b>The actual instruction is made here:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> *</span><span class="function-syntax">PackageInstruction::new_inner</span><button class="popup" onclick="togglePopup('usagePopup3')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup3">Usage of <span class="code-font"><span class="function-syntax">PackageInstruction::new_inner</span></span>:<br/><a href="4-tpc.html#SP3">&#167;3</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_bookmark</span><span class="plain-syntax"> *</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">name_text</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_type</span><span class="plain-syntax"> </span><span class="identifier-syntax">type</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">ptype_name</span><span class="plain-syntax">, </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">level</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_error_location</span><span class="plain-syntax"> *</span><span class="identifier-syntax">eloc</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_package</span><span class="plain-syntax"> **</span><span class="identifier-syntax">created</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_tree</span><span class="plain-syntax"> *</span><span class="identifier-syntax">I</span><span class="plain-syntax"> = </span><a href="2-bkm.html#SP7" class="function-link"><span class="function-syntax">InterBookmark::tree</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_warehouse</span><span class="plain-syntax"> *</span><span class="identifier-syntax">warehouse</span><span class="plain-syntax"> = </span><a href="2-bkm.html#SP7" class="function-link"><span class="function-syntax">InterBookmark::warehouse</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">STID</span><span class="plain-syntax"> = </span><a href="2-tw.html#SP8" class="function-link"><span class="function-syntax">InterWarehouse::create_symbols_table</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">warehouse</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">package_name</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">        </span><a href="3-iitf.html#SP4" class="function-link"><span class="function-syntax">TextualInter::new_symbol</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">eloc</span><span class="plain-syntax">, </span><a href="2-bkm.html#SP7" class="function-link"><span class="function-syntax">InterBookmark::scope</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">), </span><span class="identifier-syntax">name_text</span><span class="plain-syntax">, &amp;</span><span class="identifier-syntax">E</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">E</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">E</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax"> = </span><a href="2-in.html#SP5" class="function-link"><span class="function-syntax">Inode::new_with_5_data_fields</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">, </span><span class="constant-syntax">PACKAGE_IST</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="comment-syntax">/* DEFN_PACKAGE_IFLD: */</span><span class="plain-syntax">    </span><a href="2-st.html#SP17" class="function-link"><span class="function-syntax">InterSymbolsTable::id_at_bookmark</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">, </span><span class="identifier-syntax">package_name</span><span class="plain-syntax">),</span>
<span class="plain-syntax">        </span><span class="comment-syntax">/* TYPE_PACKAGE_IFLD: */</span><span class="plain-syntax">    </span><a href="3-idt.html#SP15" class="function-link"><span class="function-syntax">InterTypes::to_TID_at</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">, </span><span class="identifier-syntax">type</span><span class="plain-syntax">),</span>
<span class="plain-syntax">        </span><span class="comment-syntax">/* PTYPE_PACKAGE_IFLD: */</span><span class="plain-syntax">   </span><a href="2-st.html#SP16" class="function-link"><span class="function-syntax">InterSymbolsTable::id_from_symbol</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, </span><span class="identifier-syntax">ptype_name</span><span class="plain-syntax">),</span>
<span class="plain-syntax">        </span><span class="comment-syntax">/* SYMBOLS_PACKAGE_IFLD: */</span><span class="plain-syntax"> </span><span class="identifier-syntax">STID</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="comment-syntax">/* PID_PACKAGE_IFLD: */</span><span class="plain-syntax">     </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="comment-syntax"> but see just below...</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">, </span><span class="identifier-syntax">level</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">PID</span><span class="plain-syntax"> = </span><a href="2-tw.html#SP9" class="function-link"><span class="function-syntax">InterWarehouse::create_package</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">warehouse</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_package</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pack</span><span class="plain-syntax"> = </span><a href="2-tw.html#SP9" class="function-link"><span class="function-syntax">InterWarehouse::get_package</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">warehouse</span><span class="plain-syntax">, </span><span class="identifier-syntax">PID</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">pack</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">package_head</span><span class="plain-syntax"> = </span><span class="identifier-syntax">P</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">P</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">instruction</span><span class="plain-syntax">[</span><span class="constant-syntax">PID_PACKAGE_IFLD</span><span class="plain-syntax">] = </span><span class="identifier-syntax">PID</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><a href="2-pck.html#SP9" class="function-link"><span class="function-syntax">InterPackage::set_scope</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pack</span><span class="plain-syntax">, </span><a href="2-tw.html#SP8" class="function-link"><span class="function-syntax">InterWarehouse::get_symbols_table</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">warehouse</span><span class="plain-syntax">, </span><span class="identifier-syntax">STID</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><a href="2-tw.html#SP8" class="function-link"><span class="function-syntax">InterWarehouse::set_symbols_table_owner</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">warehouse</span><span class="plain-syntax">, </span><span class="identifier-syntax">STID</span><span class="plain-syntax">, </span><span class="identifier-syntax">pack</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><a href="3-vi.html#SP1" class="function-link"><span class="function-syntax">VerifyingInter::instruction</span></a><span class="plain-syntax">(</span><a href="2-bkm.html#SP6" class="function-link"><span class="function-syntax">InterBookmark::package</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">), </span><span class="identifier-syntax">P</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">E</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">E</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><a href="2-np.html#SP3" class="function-link"><span class="function-syntax">NodePlacement::move_to_moving_bookmark</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">IBM</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">LargeScale::note_package_name</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">pack</span><span class="plain-syntax">, </span><span class="identifier-syntax">name_text</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::eq</span><span class="plain-syntax">(</span><a href="2-sym.html#SP19" class="function-link"><span class="function-syntax">InterSymbol::identifier</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">ptype_name</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"_code"</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><a href="2-pck.html#SP16" class="function-link"><span class="function-syntax">InterPackage::mark_as_a_function_body</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pack</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::eq</span><span class="plain-syntax">(</span><a href="2-sym.html#SP19" class="function-link"><span class="function-syntax">InterSymbol::identifier</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">ptype_name</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"_linkage"</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><a href="2-pck.html#SP17" class="function-link"><span class="function-syntax">InterPackage::mark_as_a_linkage_package</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pack</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">created</span><span class="plain-syntax">) *</span><span class="identifier-syntax">created</span><span class="plain-syntax"> = </span><span class="identifier-syntax">pack</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOGIF</span><span class="plain-syntax">(</span><span class="identifier-syntax">INTER_SYMBOLS</span><span class="plain-syntax">, </span><span class="string-syntax">"Package $6 at IBM $5\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">pack</span><span class="plain-syntax">, </span><span class="identifier-syntax">IBM</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">PackageInstruction::transpose</span><button class="popup" onclick="togglePopup('usagePopup4')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup4">Usage of <span class="code-font"><span class="function-syntax">PackageInstruction::transpose</span></span>:<br/><a href="4-tpc.html#SP1">&#167;1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_construct</span><span class="plain-syntax"> *</span><span class="identifier-syntax">IC</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> *</span><span class="identifier-syntax">grid</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">grid_extent</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> **</span><span class="identifier-syntax">E</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">P</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">instruction</span><span class="plain-syntax">[</span><span class="constant-syntax">PID_PACKAGE_IFLD</span><span class="plain-syntax">] = </span><span class="identifier-syntax">grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">P</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">instruction</span><span class="plain-syntax">[</span><span class="constant-syntax">PID_PACKAGE_IFLD</span><span class="plain-syntax">]];</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">P</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">instruction</span><span class="plain-syntax">[</span><span class="constant-syntax">SYMBOLS_PACKAGE_IFLD</span><span class="plain-syntax">] = </span><span class="identifier-syntax">grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">P</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">instruction</span><span class="plain-syntax">[</span><span class="constant-syntax">SYMBOLS_PACKAGE_IFLD</span><span class="plain-syntax">]];</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>&#167;5. </b>Verification begins with sanity checks, but then does something crucial: makes
sure that the link between the package and its head node is in place. If the
instruction has just been created by <a href="4-tpc.html#SP3" class="internal">PackageInstruction::new</a> then
that will be done already &mdash; but not if the instruction has been loaded from
a binary Inter file.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">PackageInstruction::verify</span><button class="popup" onclick="togglePopup('usagePopup5')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup5">Usage of <span class="code-font"><span class="function-syntax">PackageInstruction::verify</span></span>:<br/><a href="4-tpc.html#SP1">&#167;1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_construct</span><span class="plain-syntax"> *</span><span class="identifier-syntax">IC</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_package</span><span class="plain-syntax"> *</span><span class="identifier-syntax">owner</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> **</span><span class="identifier-syntax">E</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><a href="3-vi.html#SP2" class="function-link"><span class="function-syntax">VerifyingInter::SID_field</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">owner</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">DEFN_PACKAGE_IFLD</span><span class="plain-syntax">, </span><span class="constant-syntax">PACKAGE_IST</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (*</span><span class="identifier-syntax">E</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><a href="3-vi.html#SP6" class="function-link"><span class="function-syntax">VerifyingInter::TID_field</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">owner</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">TYPE_PACKAGE_IFLD</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (*</span><span class="identifier-syntax">E</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><a href="3-vi.html#SP3" class="function-link"><span class="function-syntax">VerifyingInter::GSID_field</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">PTYPE_PACKAGE_IFLD</span><span class="plain-syntax">, </span><span class="constant-syntax">PACKAGETYPE_IST</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (*</span><span class="identifier-syntax">E</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><a href="3-vi.html#SP9" class="function-link"><span class="function-syntax">VerifyingInter::symbols_table_field</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">owner</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">SYMBOLS_PACKAGE_IFLD</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (*</span><span class="identifier-syntax">E</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><a href="3-vi.html#SP10" class="function-link"><span class="function-syntax">VerifyingInter::package_field</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">owner</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">PID_PACKAGE_IFLD</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (*</span><span class="identifier-syntax">E</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">inter_package</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pack</span><span class="plain-syntax"> = </span><a href="2-in.html#SP14" class="function-link"><span class="function-syntax">Inode::ID_to_package</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">instruction</span><span class="plain-syntax">[</span><span class="constant-syntax">PID_PACKAGE_IFLD</span><span class="plain-syntax">]);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">pack</span><span class="plain-syntax">) </span><span class="identifier-syntax">pack</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">package_head</span><span class="plain-syntax"> = </span><span class="identifier-syntax">P</span><span class="plain-syntax">; </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"no package in PID field"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">PackageInstruction::verify_children</span><button class="popup" onclick="togglePopup('usagePopup6')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup6">Usage of <span class="code-font"><span class="function-syntax">PackageInstruction::verify_children</span></span>:<br/><a href="4-tpc.html#SP1">&#167;1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_construct</span><span class="plain-syntax"> *</span><span class="identifier-syntax">IC</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> **</span><span class="identifier-syntax">E</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-pck.html#SP16" class="function-link"><span class="function-syntax">InterPackage::is_a_function_body</span></a><span class="plain-syntax">(</span><a href="4-tpc.html#SP9" class="function-link"><span class="function-syntax">PackageInstruction::at_this_head</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LOOP_THROUGH_INTER_CHILDREN</span><span class="plain-syntax">(</span><span class="identifier-syntax">C</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">C</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">instruction</span><span class="plain-syntax">[0] != </span><span class="constant-syntax">LABEL_IST</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">                (</span><span class="identifier-syntax">C</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">instruction</span><span class="plain-syntax">[0] != </span><span class="constant-syntax">LOCAL_IST</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">                (</span><span class="identifier-syntax">C</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">instruction</span><span class="plain-syntax">[0] != </span><span class="constant-syntax">CODE_IST</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">                (</span><span class="identifier-syntax">C</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">instruction</span><span class="plain-syntax">[0] != </span><span class="constant-syntax">COMMENT_IST</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">                *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><a href="2-in.html#SP15" class="function-link"><span class="function-syntax">Inode::error</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">C</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"instruction not permitted at the top level"</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP6" class="paragraph-anchor"></a><b>&#167;6. Creating from textual Inter syntax.</b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">PackageInstruction::read</span><button class="popup" onclick="togglePopup('usagePopup7')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup7">Usage of <span class="code-font"><span class="function-syntax">PackageInstruction::read</span></span>:<br/><a href="4-tpc.html#SP1">&#167;1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_construct</span><span class="plain-syntax"> *</span><span class="identifier-syntax">IC</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_bookmark</span><span class="plain-syntax"> *</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_line_parse</span><span class="plain-syntax"> *</span><span class="identifier-syntax">ilp</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_error_location</span><span class="plain-syntax"> *</span><span class="identifier-syntax">eloc</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> **</span><span class="identifier-syntax">E</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">ptype_name</span><span class="plain-syntax"> = </span><span class="identifier-syntax">LargeScale::package_type</span><span class="plain-syntax">(</span><a href="2-bkm.html#SP7" class="function-link"><span class="function-syntax">InterBookmark::tree</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">), </span><span class="identifier-syntax">ilp</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">mr</span><span class="plain-syntax">.</span><span class="identifier-syntax">exp</span><span class="plain-syntax">[1]);</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">inter_type</span><span class="plain-syntax"> </span><span class="identifier-syntax">type</span><span class="plain-syntax"> = </span><a href="3-idt.html#SP12" class="function-link"><span class="function-syntax">InterTypes::unchecked</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">identifier</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ilp</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">mr</span><span class="plain-syntax">.</span><span class="identifier-syntax">exp</span><span class="plain-syntax">[0];</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">match_results</span><span class="plain-syntax"> </span><span class="identifier-syntax">mr</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Regexp::create_mr</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Regexp::match</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr</span><span class="plain-syntax">, </span><span class="identifier-syntax">identifier</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"%((%c+)%) (%c+)"</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">type</span><span class="plain-syntax"> = </span><a href="3-idt.html#SP19" class="function-link"><span class="function-syntax">InterTypes::parse_simple</span></a><span class="plain-syntax">(</span><a href="2-bkm.html#SP7" class="function-link"><span class="function-syntax">InterBookmark::scope</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">), </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">, </span><span class="identifier-syntax">mr</span><span class="plain-syntax">.</span><span class="identifier-syntax">exp</span><span class="plain-syntax">[0], </span><span class="identifier-syntax">E</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">identifier</span><span class="plain-syntax"> = </span><span class="identifier-syntax">mr</span><span class="plain-syntax">.</span><span class="identifier-syntax">exp</span><span class="plain-syntax">[1];</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (*</span><span class="identifier-syntax">E</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">inter_package</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pack</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><a href="4-tpc.html#SP3" class="function-link"><span class="function-syntax">PackageInstruction::new</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">, </span><span class="identifier-syntax">identifier</span><span class="plain-syntax">, </span><span class="identifier-syntax">type</span><span class="plain-syntax">, </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">, </span><span class="identifier-syntax">ptype_name</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            (</span><span class="constant-syntax">inter_ti</span><span class="plain-syntax">) </span><span class="identifier-syntax">ilp</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">indent_level</span><span class="plain-syntax">, </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">, &amp;</span><span class="identifier-syntax">pack</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (*</span><span class="identifier-syntax">E</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><a href="2-bkm.html#SP5" class="function-link"><span class="function-syntax">InterBookmark::move_into_package</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">, </span><span class="identifier-syntax">pack</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Regexp::dispose_of</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP7" class="paragraph-anchor"></a><b>&#167;7. Writing to textual Inter syntax.</b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">PackageInstruction::write</span><button class="popup" onclick="togglePopup('usagePopup8')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup8">Usage of <span class="code-font"><span class="function-syntax">PackageInstruction::write</span></span>:<br/><a href="4-tpc.html#SP1">&#167;1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_construct</span><span class="plain-syntax"> *</span><span class="identifier-syntax">IC</span><span class="plain-syntax">, </span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_package</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pack</span><span class="plain-syntax"> = </span><a href="4-tpc.html#SP9" class="function-link"><span class="function-syntax">PackageInstruction::at_this_head</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">ptype_name</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">        </span><a href="2-st.html#SP14" class="function-link"><span class="function-syntax">InterSymbolsTable::global_symbol_from_ID_at_node</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">PTYPE_PACKAGE_IFLD</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"package "</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="3-iitf.html#SP13" class="function-link"><span class="function-syntax">TextualInter::write_optional_type_marker</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">TYPE_PACKAGE_IFLD</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"%S %S"</span><span class="plain-syntax">, </span><a href="2-pck.html#SP7" class="function-link"><span class="function-syntax">InterPackage::name</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pack</span><span class="plain-syntax">), </span><a href="2-sym.html#SP19" class="function-link"><span class="function-syntax">InterSymbol::identifier</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">ptype_name</span><span class="plain-syntax">));</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP8" class="paragraph-anchor"></a><b>&#167;8. </b>With the addendum of writing out the pseudo-constructs <span class="extract"><span class="extract-syntax">plug</span></span> and <span class="extract"><span class="extract-syntax">socket</span></span>
to ensure that any in the symbols table are recorded in the textual output:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> *</span><span class="function-syntax">PackageInstruction::write_plugs_and_sockets</span><button class="popup" onclick="togglePopup('usagePopup9')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup9">Usage of <span class="code-font"><span class="function-syntax">PackageInstruction::write_plugs_and_sockets</span></span>:<br/>Inter Constructs - <a href="3-ic.html#SP19">&#167;19</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_package</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pack</span><span class="plain-syntax"> = </span><a href="4-tpc.html#SP9" class="function-link"><span class="function-syntax">PackageInstruction::at_this_head</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">pack</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">inter_symbols_table</span><span class="plain-syntax"> *</span><span class="identifier-syntax">locals</span><span class="plain-syntax"> = </span><a href="2-pck.html#SP10" class="function-link"><span class="function-syntax">InterPackage::scope</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pack</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">L</span><span class="plain-syntax"> = </span><a href="2-in.html#SP13" class="function-link"><span class="function-syntax">Inode::get_level</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">) + </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LOOP_OVER_SYMBOLS_TABLE</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">locals</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-sym.html#SP13" class="function-link"><span class="function-syntax">InterSymbol::is_plug</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">                </span><a href="6-tpc.html#SP3" class="function-link"><span class="function-syntax">PlugInstruction::write_declaration</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">L</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"\n"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LOOP_OVER_SYMBOLS_TABLE</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">locals</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-sym.html#SP13" class="function-link"><span class="function-syntax">InterSymbol::is_socket</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">                </span><a href="6-tpc.html#SP3" class="function-link"><span class="function-syntax">PlugInstruction::write_declaration</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">L</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"\n"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP9" class="paragraph-anchor"></a><b>&#167;9. Package vs its head vs its name symbol.</b>Three ways to identify a package, all inter-convertible.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">PackageInstruction::is</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">package_name</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">package_name</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">D</span><span class="plain-syntax"> = </span><a href="2-sym.html#SP15" class="function-link"><span class="function-syntax">InterSymbol::definition</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">package_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">D</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-in.html#SP13" class="function-link"><span class="function-syntax">Inode::isnt</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">D</span><span class="plain-syntax">, </span><span class="constant-syntax">PACKAGE_IST</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">PackageInstruction::is_function</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">package_name</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">package_name</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">D</span><span class="plain-syntax"> = </span><a href="2-sym.html#SP15" class="function-link"><span class="function-syntax">InterSymbol::definition</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">package_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="2-pck.html#SP16" class="function-link"><span class="function-syntax">InterPackage::is_a_function_body</span></a><span class="plain-syntax">(</span><a href="4-tpc.html#SP9" class="function-link"><span class="function-syntax">PackageInstruction::at_this_head</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">D</span><span class="plain-syntax">));</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">inter_package</span><span class="plain-syntax"> *</span><span class="function-syntax">PackageInstruction::which</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">package_name</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">package_name</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">D</span><span class="plain-syntax"> = </span><a href="2-sym.html#SP15" class="function-link"><span class="function-syntax">InterSymbol::definition</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">package_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">D</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="2-in.html#SP14" class="function-link"><span class="function-syntax">Inode::ID_to_package</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">D</span><span class="plain-syntax">, </span><span class="identifier-syntax">D</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">instruction</span><span class="plain-syntax">[</span><span class="constant-syntax">PID_PACKAGE_IFLD</span><span class="plain-syntax">]);</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">inter_package</span><span class="plain-syntax"> *</span><span class="function-syntax">PackageInstruction::at_this_head</span><button class="popup" onclick="togglePopup('usagePopup10')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup10">Usage of <span class="code-font"><span class="function-syntax">PackageInstruction::at_this_head</span></span>:<br/><a href="4-tpc.html#SP5">&#167;5</a>, <a href="4-tpc.html#SP7">&#167;7</a>, <a href="4-tpc.html#SP8">&#167;8</a><br/>Inter Trees - <a href="2-it.html#SP9">&#167;9</a><br/>Bookmarks - <a href="2-bkm.html#SP6">&#167;6</a><br/>Packages - <a href="2-pck.html#SP5">&#167;5</a>, <a href="2-pck.html#SP11">&#167;11</a>, <a href="2-pck.html#SP20">&#167;20</a><br/>Transmigration - <a href="2-trn.html#SP5_2">&#167;5.2</a>, <a href="2-trn.html#SP6">&#167;6</a><br/>Inter Constructs - <a href="3-ic.html#SP7">&#167;7</a><br/>Inter in Text Files - <a href="3-iitf.html#SP7">&#167;7</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">D</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">D</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-in.html#SP13" class="function-link"><span class="function-syntax">Inode::isnt</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">D</span><span class="plain-syntax">, </span><span class="constant-syntax">PACKAGE_IST</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="2-in.html#SP14" class="function-link"><span class="function-syntax">Inode::ID_to_package</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">D</span><span class="plain-syntax">, </span><span class="identifier-syntax">D</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">instruction</span><span class="plain-syntax">[</span><span class="constant-syntax">PID_PACKAGE_IFLD</span><span class="plain-syntax">]);</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="function-syntax">PackageInstruction::name_symbol</span><button class="popup" onclick="togglePopup('usagePopup11')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup11">Usage of <span class="code-font"><span class="function-syntax">PackageInstruction::name_symbol</span></span>:<br/>Packages - <a href="2-pck.html#SP7">&#167;7</a><br/>Transmigration - <a href="2-trn.html#SP3_3">&#167;3.3</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_package</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pack</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">pack</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">D</span><span class="plain-syntax"> = </span><span class="identifier-syntax">pack</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">package_head</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">package_name</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">        </span><a href="2-st.html#SP14" class="function-link"><span class="function-syntax">InterSymbolsTable::symbol_from_ID_at_node</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">D</span><span class="plain-syntax">, </span><span class="constant-syntax">DEFN_PACKAGE_IFLD</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">package_name</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP10" class="paragraph-anchor"></a><b>&#167;10. </b>And the type:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="function-syntax">PackageInstruction::get_type_of</span><button class="popup" onclick="togglePopup('usagePopup12')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup12">Usage of <span class="code-font"><span class="function-syntax">PackageInstruction::get_type_of</span></span>:<br/>Packages - <a href="2-pck.html#SP8">&#167;8</a><br/>Transmigration - <a href="2-trn.html#SP5_2_1">&#167;5.2.1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_tree</span><span class="plain-syntax"> *</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-in.html#SP13" class="function-link"><span class="function-syntax">Inode::is</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">PACKAGE_IST</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="2-st.html#SP13" class="function-link"><span class="function-syntax">InterSymbolsTable::symbol_from_ID</span></a><span class="plain-syntax">(</span>
<span class="plain-syntax">            </span><a href="2-it.html#SP3" class="function-link"><span class="function-syntax">InterTree::global_scope</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">), </span><span class="identifier-syntax">P</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">instruction</span><span class="plain-syntax">[</span><span class="constant-syntax">PTYPE_PACKAGE_IFLD</span><span class="plain-syntax">]);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP11" class="paragraph-anchor"></a><b>&#167;11. </b>These look invariant-busting and dubious: see <a href="2-trn.html" class="internal">Transmigration</a> for why they
are needed. And see also <a href="../imperative-module/3-fnc.html" class="internal">Functions (in imperative)</a>.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">PackageInstruction::set_type</span><button class="popup" onclick="togglePopup('usagePopup13')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup13">Usage of <span class="code-font"><span class="function-syntax">PackageInstruction::set_type</span></span>:<br/>Transmigration - <a href="2-trn.html#SP5_2_1">&#167;5.2.1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_tree</span><span class="plain-syntax"> *</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">ptype</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-in.html#SP13" class="function-link"><span class="function-syntax">Inode::is</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">PACKAGE_IST</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">P</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">instruction</span><span class="plain-syntax">[</span><span class="constant-syntax">PTYPE_PACKAGE_IFLD</span><span class="plain-syntax">] = </span><a href="2-st.html#SP16" class="function-link"><span class="function-syntax">InterSymbolsTable::id_from_symbol</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, </span><span class="identifier-syntax">ptype</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"wrote primitive to non-primitive invocation"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">PackageInstruction::set_name_symbol</span><button class="popup" onclick="togglePopup('usagePopup14')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup14">Usage of <span class="code-font"><span class="function-syntax">PackageInstruction::set_name_symbol</span></span>:<br/>Transmigration - <a href="2-trn.html#SP3_3">&#167;3.3</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_package</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pack</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">pack</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"no package"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">D</span><span class="plain-syntax"> = </span><span class="identifier-syntax">pack</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">package_head</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">definition</span><span class="plain-syntax"> = </span><span class="identifier-syntax">D</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_package</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S_pack</span><span class="plain-syntax"> = </span><a href="2-sym.html#SP3" class="function-link"><span class="function-syntax">InterSymbol::package</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">D</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">instruction</span><span class="plain-syntax">[</span><span class="constant-syntax">DEFN_PACKAGE_IFLD</span><span class="plain-syntax">] =</span>
<span class="plain-syntax">        </span><a href="2-st.html#SP15" class="function-link"><span class="function-syntax">InterSymbolsTable::id_from_symbol_not_creating</span></a><span class="plain-syntax">(</span><a href="2-pck.html#SP4" class="function-link"><span class="function-syntax">InterPackage::tree</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S_pack</span><span class="plain-syntax">), </span><span class="identifier-syntax">S_pack</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">PackageInstruction::set_data_type</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_package</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pack</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_type</span><span class="plain-syntax"> </span><span class="identifier-syntax">type</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">pack</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"no package"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">D</span><span class="plain-syntax"> = </span><span class="identifier-syntax">pack</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">package_head</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">D</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">instruction</span><span class="plain-syntax">[</span><span class="constant-syntax">TYPE_PACKAGE_IFLD</span><span class="plain-syntax">] =</span>
<span class="plain-syntax">        </span><a href="3-idt.html#SP15" class="function-link"><span class="function-syntax">InterTypes::to_TID</span></a><span class="plain-syntax">(</span><a href="2-pck.html#SP10" class="function-link"><span class="function-syntax">InterPackage::scope</span></a><span class="plain-syntax">(</span><a href="2-pck.html#SP5" class="function-link"><span class="function-syntax">InterPackage::parent</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pack</span><span class="plain-syntax">)), </span><span class="identifier-syntax">type</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<nav role="progress"><div class="progresscontainer">
    <ul class="progressbar"><li class="progressprev"><a href="4-toc.html">&#10094;</a></li><li class="progresschapter"><a href="P-wtmd.html">P</a></li><li class="progresschapter"><a href="1-bm.html">1</a></li><li class="progresschapter"><a href="2-it.html">2</a></li><li class="progresschapter"><a href="3-ic.html">3</a></li><li class="progresscurrentchapter">4</li><li class="progresssection"><a href="4-tcc.html">tcc</a></li><li class="progresssection"><a href="4-tcc2.html">tcc2</a></li><li class="progresssection"><a href="4-tic.html">tic</a></li><li class="progresssection"><a href="4-tic2.html">tic2</a></li><li class="progresssection"><a href="4-tnc.html">tnc</a></li><li class="progresssection"><a href="4-toc.html">toc</a></li><li class="progresscurrent">tpc</li><li class="progresssection"><a href="4-tpc2.html">tpc2</a></li><li class="progresssection"><a href="4-tpc3.html">tpc3</a></li><li class="progresssection"><a href="4-tpc4.html">tpc4</a></li><li class="progresssection"><a href="4-tpc5.html">tpc5</a></li><li class="progresssection"><a href="4-tpc6.html">tpc6</a></li><li class="progresssection"><a href="4-tpc7.html">tpc7</a></li><li class="progresssection"><a href="4-tpc8.html">tpc8</a></li><li class="progresssection"><a href="4-ttc.html">ttc</a></li><li class="progresssection"><a href="4-tvc.html">tvc</a></li><li class="progresschapter"><a href="5-tac.html">5</a></li><li class="progresschapter"><a href="6-tpc.html">6</a></li><li class="progressnext"><a href="4-tpc2.html">&#10095;</a></li></ul></div>
</nav><!-- End of weave -->

		</main>
	</body>
</html>

